package com.blb.aop.service.impl;

import com.blb.aop.dao.StudentDAO;
import com.blb.aop.dao.impl.StudentDAOImpl;
import com.blb.aop.entity.Student;
import com.blb.aop.service.StudentService;
import com.blb.aop.util.MyLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class StudentServiceImpl implements StudentService {

    @Autowired
    private StudentDAO studentDAO;

    @MyLog("save")
    @Override
    public void save(Student student) {
        studentDAO.insert(student);
    }

    @MyLog("modify")
    @Override
    public void modify(Student student) {
        studentDAO.update(student);
    }

    @MyLog("remove")
    @Override
    public void remove(Long id) {
        studentDAO.delete(id);
        int x = 10 / 0;
    }

    @MyLog("findById")
    @Override
    public Student findById(Long id) {
        return studentDAO.selectById(id);
    }
}
